// components/computed/computed.js
import {ComponentWithComputed} from 'miniprogram-computed'
import {storeBindingsBehavior} from 'mobx-miniprogram-bindings'
import {demostore} from '../../store/demostore'
ComponentWithComputed({
  behaviors:[storeBindingsBehavior],
  data:{
    num1:1,
    num2:2
  },
  computed:{
    sum(data){
      return data.num1+data.num2
    }
  },
  watch:{
    num1:()=>{
      console.log("num1发生了改变");
    }
  },
  methods:{
    changeNum(){
      this.setData({
        num1:this.data.num1+1
      })
    }
  },
  storeBindings:{
    store:demostore,
    fields:{
      num:"num",
      num2:"num2",
      doubleNum:"doubleNum"
    },
    actions:{
      changenum:"changenum"
    }
  }

})